package org.jcut.config;



import javax.servlet.http.HttpServletRequest;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;


@Aspect
@Configuration
public class logger {
	@Autowired
	HttpServletRequest request;
	@Pointcut("@within(org.springframework.stereotype.Controller) || @within(org.springframework.web.bind.annotation.RestController)")
    public void cutController(){
    }

    @Around("cutController()")
    public Object recordSysLog(ProceedingJoinPoint joinPoint) throws Throwable {
    	 Object ob=null;
    	   try {
    		  
               System.out.println("Silencing cell phones");
               System.out.println("Taking seats");
               ob=joinPoint.proceed();
               System.out.println("Demanding a refund");
               
           } catch (Throwable throwable) {
        	   System.err.println("异常来了");
        	   throw throwable;
           }
    	   return ob;
        }
    	
}
